package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * 演示跨域请求和解决
 * @author 千锋健哥
 */
@Controller
@RequestMapping("/cross")
@CrossOrigin("http://localhost:8081") //允许来自8081服务器发来的请求
public class CrossController {

    @RequestMapping("/test1")
    @ResponseBody
    public String test1(){
        System.out.println("test1~~");
        return "ok";
    }

    @RequestMapping("/test2")
    @ResponseBody
    public String test2(){
        System.out.println("test2~~");
        return "ok";
    }
}
